home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS Toolkit
/
BBS Toolkit.iso
/
maximus
/
mxms_161.zip
/
MAXHEAD.ZIP
/
PROG.H
< prev
next >
Wrap
C/C++ Source or Header
|
1990-11-01
|
8KB
|
241 lines
/***************************************************************************
* *
* MAXIMUS-CBCS Source Code, Version 1.02 *
* Copyright 1989, 1990 by Scott J. Dudley. All rights reserved. *
* *
* General include file. Lots of machine-dependant stuff here. *
* *
* For complete details of the licensing restrictions, please refer to *
* the licence agreement, which is published in its entirety in MAX.C *
* and LICENCE.MAX. *
* *
* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE *
* MAXIMUS-CBCS LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF THIS *
* AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO NOT HAVE *
* THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHOR AT ONE OF THE *
* ADDRESSES LISTED BELOW. IN NO EVENT SHOULD YOU PROCEED TO USE THIS *
* FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE MAXIMUS-CBCS LICENSING *
* AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH THE *
* AUTHOR. *
* *
* You can contact the author at one of the address listed below: *
* *
* Scott Dudley FidoNet 1:249/106 *
* 777 Downing St. IMEXnet 89:483/202 *
* Kingston, Ont. Internet f106.n249.z1.fidonet.org *
* Canada - K7M 5N3 BBS (613) 389-8315 - HST/14.4K, 24hrs *
* *
***************************************************************************/
#ifndef __PROG_H_DEFINED
#define __PROG_H_DEFINED
#include "compiler.h"
#include <share.h>
#include <sys/types.h>
#include <sys/stat.h>
#if !defined(__DOS_DEF_) && defined(__TURBOC__)
void __emit__();
void __int__(int interruptnum);
#define geninterrupt(i) __int__(i)
#endif
typedef long timer_t;
#define REGISTER
#ifndef TRUE
#define FALSE 0
#define TRUE 1
#endif
#ifdef PATHLEN
#undef PATHLEN
#endif
#define _PRIVS_NUM 13 /* Maximum priv levels for Maximus */
#define CHAR_BITS 8 /* Number of bits in a `char' variable */
#define PATHLEN 120 /* Max. length of a path */
#define MAX_DRIVES 26 /* Maximum number of drives on system; *
* for MS-DOS, A through Z. Used by *
* Save_Dir()... */
#ifdef __TURBOC__
/* This won't be emitted if we compile with -O! */
#define EmbedCopyright() goto __label_start; __label_emit: \
__emit__('\n','\n','\n','\n','C','o','p','y','r','i','g','h','t',' ','(','c',')',' ', \
'1','9','9','0',' ','b','y',' ','S','c','o','t','t',' ','J','.',' ', \
'D','u','d','l','e','y',',',' ','A','l','l',' ','R','i','g','h','t','s',' ', \
'R','e','s','e','r','v','e','d','.','\n','\n','\n','\n'); \
__label_start:
#else
#define EmbedCopyright()
#endif
#if (defined(__TURBOC__) && defined(__FARDATA__))
#include "alc.h"
#define malloc(n) farmalloc(n)
#define calloc(n,u) farcalloc(n,u)
#define free(p) farfree(p)
#define realloc(p,n) farrealloc(p,n)
#define coreleft() farcoreleft()
#endif
#define Hello(prog,desc,version,year) EmbedCopyright(); printf("\n" prog " " desc ", Version %s.\nCopyright 1990 by Scott J. Dudley of 1:249/106. All rights reserved.\n\n",version)
#define trace(d,t) printf(#d"=<%"#t">\n",d);
#define carrier_flag (prm.carrier_mask)
#define BitOff(a,x) (void)((a)[(x)/CHAR_BITS] &= ~(1 << ((x) % CHAR_BITS)))
#define BitOn(a,x) (void)((a)[(x)/CHAR_BITS] |= (1 << ((x) % CHAR_BITS)))
#define IsBit(a,x) ((a)[(x)/CHAR_BITS] & (1 << ((x) % CHAR_BITS)))
#define lputs(handle,string) write(handle,string,strlen(string))
#define dim(a) (sizeof(a)/sizeof(a[0]))
#define eqstr(str1,str2) (! strcmp(str1,str2))
#define eqstri(str1,str2) (! stricmp(str1,str2))
#define isnl(string) (*(string)=='\0')
#define mknl(string) (*(string)='\0')
#define smalloc(p,size) ((p)==NULL?((((p)=malloc(size))==NULL)?(NoMem(),0):-1):0)
#define sfree(p) ((p)!=NULL?free(p),(p)=NULL:0)
#define divby(num,div) ((num % div)==0)
#define striplast(s,c) (s[strlen(s)-1]=(*s && s[strlen(s)-1]==c) ? '\0' : s[strlen(s)-1])
#define f_tolwr(c) (_to_lwr[c])
#define f_toupr(c) (_to_upr[c])
#ifndef updcrc
#define updcrc(cp, crc) (crctab[((crc >> 8) & 255) ^ cp] ^ (crc << 8))
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
struct _stamp /* DOS-style datestamp */
{
struct
{
unsigned int da : 5;
unsigned int mo : 4;
unsigned int yr : 7;
} date;
struct
{
unsigned int ss : 5;
unsigned int mm : 6;
unsigned int hh : 5;
} time;
};
union stamp_combo /* Union so we can access stamp as "int" or by individual components */
{
struct _stamp msg_st;
struct
{
unsigned int date;
unsigned int time;
} dos_st;
unsigned long ldate;
};
struct __priv
{
char *name;
int priv;
};
extern char months[][10],
weekday[][10];
extern char months_ab[][4],
weekday_ab[][4];
extern struct __priv _privs[];
/* MS docs use both SH_DENYNONE and SH_DENYNO */
#if !defined(SH_DENYNONE) && defined(SH_DENYNO)
#define SH_DENYNONE SH_DENYNO
#endif
#define shopen(path,access) sopen(path,access,SH_DENYNONE,S_IREAD | S_IWRITE)
#define cshopen(path,access,mode) sopen(path,access,SH_DENYNONE,mode)
#ifndef __TURBOC__
int fossil_wherex(void);
int fossil_wherey(void);
void pascal fossil_getxy(char *row, char *col);
#define textattr(attr)
#define getdisk() get_disk()
#define setdisk(drive) set_disk(drive)
#define wherex() fossil_wherex()
#define wherey() fossil_wherey()
#define gotoxy(x,y) fossil_gotoxy((char)x,(char)y)
#define movmem(source,dest,count) memmove(dest, source, count)
#define getvect(int) _dos_getvect(int)
#define setvect(int, func) _dos_setvect(int, func)
#define inportb(port) inp(port)
#define outportb(port, byte) outp(port, byte)
#endif
#if (defined(MSDOS) || defined(__TURBOC__)) && !defined(OS_2)
/* these asm functions are declared far so they are usable in
* any memory model.
*/
int pascal far DdosInstalled(void);
#define vbuf_flush() {if (displaymode==VIDEO_ibm) VidSync();}
#else
#define DdosInstalled() FALSE
void vbuf_flush(void);
#endif
#endif
#ifdef OS_2
void vbuf_flush(void);
void SnSetPipeName(char *pipename);
void SnWrite(char *str);
#define Start_Shadow()
#define End_Shadow()
#else
void pascal Start_Shadow(void);
void pascal End_Shadow(void);
#endif
/*
> typedef byte unsigned char;
> extern struct {
> byte winleft, wintop, winright, winbottom;
> byte attribute, normattr;
> byte currmode;
> byte screenheight, screenwidth;
> byte graphmode, snow;
> void far *ram;
> } _video;
> main() {
> _video.winbottom = (_video.screenheight = 50) - 1;
> ...
> }
*/